//导入模块
const fs = require("fs")
const path = require("path")

//拼接地址
const FullPath = path.join(__dirname, "./data/info.json")
//读取info.json中的数
const res = fs.readFileSync(FullPath, "utf8")
console.log(res)
// //反序列化
const newArr = JSON.parse(res)
// //生成随机对象
const k = parseInt(Math.random() * newArr.length - 1)
console.log(k)
// //给count+1
newArr[k].count += 1
// //转回字符串
fs.writeFileSync(FullPath, JSON.stringify(newArr))
